package br.ufmg.dcc.simulesspl.model;

import java.util.ArrayList;
import java.util.List;


public class GameBoard {
	private ProjectCard project;
	private int totalCode = 0;
	private int totalBugs = 0;
	
	private List<Sprint> pastSprints = new ArrayList<Sprint>();
	private Sprint currentSprint;

	public void setProject(ProjectCard projectCard) {
		project = projectCard;
	}
	
	public ProjectCard getProject() {
		return project;
	}

	public boolean isOver() {
		return totalCode >= project.getSize() && totalBugs == 0;
	}
	
	public void applySprint() {
		totalBugs += currentSprint.getBugs();
		totalCode += currentSprint.getCode();
		totalBugs = Math.max(0, totalBugs - currentSprint.getBugFixes());
		pastSprints.add(currentSprint);
		currentSprint = null;
	}
	
	public Sprint getCurrentSprint() {
		return currentSprint;
	}

	public void setCurrentSprint(Sprint currentSprint) {
		this.currentSprint = currentSprint;
	}

	public List<Sprint> getPastSprints() {
		return pastSprints;
	}

	public int getTotalCode() {
		return totalCode;
	}

	public int getTotalBugs() {
		return totalBugs;
	}
	
}
